/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is Forte for Java, Community Edition. The Initial * Developer of the Original Code is Sun Microsystems, Inc. Portions * Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved. */ package org.netbeans.modules.objectbrowser; import java.io.ObjectInput; import java.io.IOException; import javax.swing.SwingUtilities; import org.openide.util.NbBundle; import org.openide.awt.SplittedPanel; import org.openide.windows.TopComponent; import org.openide.windows.WindowManager; import org.openide.windows.Mode; import org.openide.windows.Workspace; import org.openide.TopManager; import org.openide.util.HelpCtx; import org.openide.explorer.ExplorerPanel; /** * Implementation of visual component of class browser. * * @author Jan Jancura */ public class ObjectBrowser extends TopComponent { static final long serialVersionUID =-1915290633440087130L; /** name of object browser mode */ public static final String MODE_NAME = "objectBrowser"; // NOI18N // variables ................................................................. private boolean first = true; // Variables declaration - do not modify//G EN-BEGIN:variables private SplittedPanel jSplitPane1; private ClassBrowserHierarchyTranslator classBrowserHierarchyTranslator1; private SplittedPanel jSplitPane2; private ExplorerBean explorerBean1; private ExplorerBean explorerBean2; private ExplorerBean explorerBean4; // End of variables declaration//G EN-END:variables // init ...................................................................... /** Initializes the Form */ public ObjectBrowser () { initComponents (); setName (NbBundle.getBundle (ObjectBrowser.class). getString ("CTL_Browser_window_name")); // dock into right mode on browsing workspace /* WindowManager wm = TopManager.getDefault ().getWindowManager (); Workspace browsing = wm.findWorkspace (ObjectBrowserModule.BROWSING_WORKSPACE); if (browsing != null) { Mode browserMode = browsing.findMode (MODE_NAME); if (browserMode != null) browserMode.dockInto (this); }*/ } /** Deserialization, sets deserialized instance as default one */ public void readExternal (ObjectInput in) throws IOException, ClassNotFoundException { super.readExternal(in); ShowBrowserAction.objectBrowser = this; } // TopComponent implementation ............................................... /** * Sets focus to the first panel. */ protected void componentActivated () { if (!first) return; SwingUtilities.invokeLater (new Runnable () { public void run () { explorerBean1.requestDefaultFocus (); first = false; } }); } /** * detach from explorer actions. */ protected void componentDeactivated () { if (ExplorerBean.explorerActions != null) ExplorerBean.explorerActions.detach (); } /** Probably not used unless browser newly created. */ public HelpCtx getHelpCtx () { return ExplorerPanel.getHelpCtx ( getActivatedNodes (), new HelpCtx (ObjectBrowser.class) ); } /** * Opens and initializes OB on given workspace. */ public void open (Workspace w) { if (w == null) w = TopManager.getDefault ().getWindowManager (). getCurrentWorkspace (); if (w.findMode (this) == null) { Mode mode = w.findMode (MODE_NAME); if (mode == null) mode = ObjectBrowserModule.createOBMode (w); mode.dockInto (this); } super.open (w); } // other methods ............................................................. /** This method is called from within the constructor to * initialize the form. * WARNING: Do NOT modify this code. The content of this method is * always regenerated by the FormEditor. */ private void initComponents () {//G EN-BEGIN:initComponents setLayout (new java.awt.BorderLayout ()); classBrowserHierarchyTranslator1 = new ClassBrowserHierarchyTranslator (); classBrowserHierarchyTranslator1.setLayout (new java.awt.FlowLayout ()); add (classBrowserHierarchyTranslator1, "North"); // NOI18N jSplitPane1 = new SplittedPanel (); jSplitPane1.setSplitterComponent (new SplittedPanel.EmptySplitter (3)); // jSplitPane1.setSplitType (SplittedPanel.VERTICAL); jSplitPane1.setSplitPosition (33); jSplitPane2 = new SplittedPanel (); jSplitPane2.setSplitterComponent (new SplittedPanel.EmptySplitter (3)); // jSplitPane2.setSplitType (SplittedPanel.VERTICAL); jSplitPane2.setSplitPosition (50); explorerBean2 = new ExplorerBean (); explorerBean2.setFilterSettings (new ExplorerBean.FilterSettings (new boolean [] {false, false, true})); explorerBean2.setTitle (NbBundle.getBundle (ObjectBrowser.class).getString ("CTL_Members")); explorerBean2.setInputName ("b"); // NOI18N explorerBean2.setToolbarVisible (true); try { explorerBean2.setExplorerViewClassName ("org.openide.explorer.view.ListView"); // NOI18N } catch (java.beans.PropertyVetoException e1) { e1.printStackTrace (); } jSplitPane2.add (explorerBean2, SplittedPanel.ADD_SECOND); explorerBean4 = new ExplorerBean (); explorerBean4.setFilterSettings (new ExplorerBean.FilterSettings (new boolean [] {false, true, false})); explorerBean4.setTitle (NbBundle.getBundle (ObjectBrowser.class).getString ("CTL_Objects")); explorerBean4.setOutputName ("b"); // NOI18N explorerBean4.setInputName ("a"); // NOI18N explorerBean4.setToolbarVisible (true); try { explorerBean4.setExplorerViewClassName ("org.openide.explorer.view.ListView"); // NOI18N } catch (java.beans.PropertyVetoException e1) { e1.printStackTrace (); } jSplitPane2.add (explorerBean4, SplittedPanel.ADD_FIRST); jSplitPane1.add (jSplitPane2, SplittedPanel.ADD_SECOND); explorerBean1 = new ExplorerBean (); explorerBean1.setFilterSettings (new ExplorerBean.FilterSettings (new boolean [] {true, false, false})); explorerBean1.setTitle (NbBundle.getBundle (ObjectBrowser.class).getString ("CTL_Packages")); explorerBean1.setOutputName ("a"); // NOI18N explorerBean1.setToolbarVisible (true); try { explorerBean1.setExplorerViewClassName ("org.openide.explorer.view.ListView"); // NOI18N } catch (java.beans.PropertyVetoException e1) { e1.printStackTrace (); } jSplitPane1.add (explorerBean1, SplittedPanel.ADD_FIRST); add (jSplitPane1, "Center"); // NOI18N java.awt.Dimension d = java.awt.Toolkit.getDefaultToolkit ().getScreenSize (); setPreferredSize (new java.awt.Dimension (d.width / 2, (d.height * 2) / 5)); } public static void main(java.lang.String[] args) { new ObjectBrowser ().setVisible (true); } } /* * Log * 26 src-jtulach1.25 1/13/00 Radko Najman I18N * 25 src-jtulach1.24 12/15/99 Jan Jancura * 24 src-jtulach1.23 12/15/99 Jan Jancura Bug 4593 - uninstall OB * + utils modul * 23 src-jtulach1.22 11/5/99 Jesse Glick Context help jumbo * patch. * 22 src-jtulach1.21 10/23/99 Ian Formanek NO SEMANTIC CHANGE - Sun * Microsystems Copyright in File Comment * 21 src-jtulach1.20 8/18/99 Jan Jancura Localization * 20 src-jtulach1.19 8/9/99 Ian Formanek Generated Serial Version * UID * 19 src-jtulach1.18 8/1/99 David Simonek deserialization to * default instance * 18 src-jtulach1.17 7/28/99 Jan Jancura * 17 src-jtulach1.16 7/21/99 David Simonek installing browsing * workspace and mode.. * 16 src-jtulach1.15 7/19/99 Jesse Glick Context help. * 15 src-jtulach1.14 7/8/99 Jesse Glick Context help. * 14 src-jtulach1.13 6/9/99 Ian Formanek ---- Package Change To * org.openide ---- * 13 src-jtulach1.12 5/26/99 Ian Formanek changed deprecated code * 12 src-jtulach1.11 5/26/99 Ian Formanek Fixed incorrect usage of * getBundle * 11 src-jtulach1.10 5/17/99 Jan Jancura Bug 1535, 1765 * 10 src-jtulach1.9 5/12/99 Jan Jancura * 9 src-jtulach1.8 5/7/99 Jan Jancura * 8 src-jtulach1.7 5/6/99 Jan Jancura * 7 src-jtulach1.6 4/26/99 Jan Jancura * 6 src-jtulach1.5 4/16/99 Jan Jancura * 5 src-jtulach1.4 4/8/99 Jan Jancura * 4 src-jtulach1.3 4/8/99 Jan Jancura * 3 src-jtulach1.2 4/2/99 Jan Jancura * 2 src-jtulach1.1 3/23/99 Jan Jancura * 1 src-jtulach1.0 3/23/99 Jan Jancura * $ */